﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace cc
{
    class Aithmetic : Calkulator
    {
        public double plus()
        {
            double operant = operant1 + operant2;
            return operant;
        }

        public double minus()
        {
            double operant = operant1 - operant2;
            return operant;
        }

        public double multiply()
        {
            double operant = operant1 * operant2;
            return operant;
        }

        public double division()
        {
            double operant;
            if (operant1 != 0)
            {
                operant = operant1 / operant2;
            }
            else
            {
                operant1 = -2;
                operant2 = -1;
                operant = 0;
            }
            return operant;
        }

        public double koren()
        {
            double operant;
            if (operant1 >= 0)
                operant = Math.Sqrt(operant1);
            else
            {
                operant1 = -2;
                operant2 = -1;
                operant = 0;
                //operant = Convert.ToDouble(ConsoleKey.End);
            }
            return operant;
        }

        public double stepen()
        {
            double operant;
            operant = Math.Pow(operant1, operant2);
            return operant;
        }

        public void a_equally(string a)
        {
            if (a == "+")
                rezult = plus();
            if (a == "-")
                rezult = minus();
            if (a == "*")
                rezult = multiply();
            if (a == "/")
                rezult = division();
            if (a == "^")
                rezult = stepen();
            if (a == "sqrt")
                rezult = koren();

        }

    }
}